import request from '@/utils/request'

export default {
    selectAll() {
        return request({
          url: `/rbac/permission/selectAll`,
          method: 'get'
        })
    },
    deleteById(id) {
        return request({
          url: `/rbac/permission/deleteById/${id}`,
          method: 'delete'
        })
    },
    add(permission) {
      return request({
        url: `/rbac/permission/add`,
        method: 'post',
        data: permission
      })
    },
    selectById(id) {
      return request({
        url: `/rbac/permission/selectById/${id}`,
        method: 'get'
      })
    },
    update(permission) {
      return request({
        url: `/rbac/permission/update`,
        method: 'put',
        data: permission
      })
    },
    selectAssignedPermission(roleId) {
      return request({
        url: `/rbac/permission/selectAssignedPermission/${roleId}`,
        method: 'get'
      })
    },
    assignPermission(roleId, permissionIds) {
      return request({
        url: `/rbac/permission/assignPermission`,
        method: 'post',
        params: {roleId, permissionIds}
      })
    }
}
